package pdm.yamba;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class BaseActivity extends Activity {

	protected MainApplication app;
	
	@Override 
	protected void onCreate(android.os.Bundle savedInstanceState) 
	{		
		super.onCreate(savedInstanceState);
		app = (MainApplication) getApplication();
	};
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.base, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) 
	{
		Intent intent = null;
		switch (item.getItemId()) 
		{			
			case R.id.action_timeline:
				intent = new Intent(this, TimelineActivity.class);
				startActivity(intent);				
			break;		
			case R.id.action_showUserInfo:
				intent = new Intent(this, UserInfoActivity.class);
				startActivity(intent);
			break;
			case R.id.action_status:
				intent = new Intent(this, StatusActivity.class);
				startActivity(intent);				
			break;
			case R.id.action_preferences:
				intent = new Intent(this, PreferencesActivity.class);
				startActivity(intent);	
			case R.id.action_update:
				((TimelineActivity)this).updateList();		
			break;
			default:
				return super.onOptionsItemSelected(item);
		}
		
		return true;
	}
}
